public class Demo13 {
        public static void main(String[] args) throws InterruptedException {
            Thread t1 = new Thread(() -> {
                System.out.println("你正在转账");
                while (!Thread.currentThread().isInterrupted()) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        break;
                    }
                }
                System.out.println("你停止了转账");
            });

            System.out.println("老板喊你开始转账");
            t1.start();
            Thread.sleep(4000);
            System.out.println("老板发现对方是骗子，打电话通知你");
            t1.interrupt();
        }
}
